import oss2

AccessKeyId = "LTAI5tHq6XHWE75kZTZJQaKa"
AccessKeySecret = "TTxnHGl8tOHVoO0CtxkdLxoSJlhRnv"
auth = oss2.Auth(AccessKeyId, AccessKeySecret)


def put_object_oss(ObjectName, LocalFile, BucketName='zh666'):
    # 对象存储在哪就填写哪，Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
    endpoint = 'oss-cn-hongkong.aliyuncs.com'

    # 填写Bucket名称。
    bucket = oss2.Bucket(auth, endpoint, BucketName)
    # 上传文件名，本地文件路径
    bucket.put_object(ObjectName, LocalFile)
    # 返回的网址
    return f"https://{BucketName}.{endpoint}/{ObjectName}"
